bitkeeper revision 1.546.1.1 (3fa3e1b4UwJQtnD-lZcvMsbqR-XhSA)
authorakw27@labyrinth.cl.cam.ac.uk <akw27@labyrinth.cl.cam.ac.uk>
Sat, 1 Nov 2003 16:39:16 +0000 (16:39 +0000)
committerakw27@labyrinth.cl.cam.ac.uk <akw27@labyrinth.cl.cam.ac.uk>
Sat, 1 Nov 2003 16:39:16 +0000 (16:39 +0000)
sched hypercall unification -- tidying things up in
anticipation of suspend/resume

xen/arch/i386/entry.S
xen/common/schedule.c
xen/include/hypervisor-ifs/hypervisor-if.h
xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h

index 953a2fe03d93cdae5084ae8c485882b9b80551ff..1c828bc1ab4e2784e37cd5df6d351ff7d46334fc 100644 (file)
@@ -713,8 +713,7 @@ ENTRY(hypervisor_call_table)
         .long SYMBOL_NAME(do_set_callbacks)
         .long SYMBOL_NAME(do_net_io_op)
         .long SYMBOL_NAME(do_fpu_taskswitch)
-        .long SYMBOL_NAME(do_yield)
-        .long SYMBOL_NAME(kill_domain)
+        .long SYMBOL_NAME(do_sched_op)
         .long SYMBOL_NAME(do_dom0_op)
         .long SYMBOL_NAME(do_network_op)
         .long SYMBOL_NAME(do_block_io_op)
index 9cd98b65a5fdd75b28a930c77d803d3f363166f3..53d7b576b6a55ad54ce24d7319f3f0dd947b7a26 100644 (file)
@@ -111,9 +111,9 @@ static void __calc_evt(struct task_struct *p)
 }
 
 
-/******************************************************************************
-* Add and remove a domain
-******************************************************************************/
+/*
+ * Add and remove a domain
+ */
 void sched_add_domain(struct task_struct *p) 
 {
     p->state       = TASK_SUSPENDED;
@@ -157,9 +157,9 @@ void init_idle_task(void)
 }
 
 
-/****************************************************************************
+/*
  * wake up a domain which had been sleeping
- ****************************************************************************/
+ */
 int wake_up(struct task_struct *p)
 {
     unsigned long flags;
@@ -194,9 +194,9 @@ int wake_up(struct task_struct *p)
     return ret;
 }
 
-/****************************************************************************
+/*
  * Voluntarily yield the processor to another domain, until an event occurs.
- ****************************************************************************/
+ */
 long do_yield(void)
 {
     current->state = TASK_INTERRUPTIBLE;
@@ -205,18 +205,47 @@ long do_yield(void)
     return 0;
 }
 
-/****************************************************************************
+/*
+ *  Demultiplex scheduler-related hypercalls.
+ */
+long do_sched_op(unsigned long op)
+{
+    long ret = 0;
+
+    switch( op ) 
+    {
+
+    case SCHEDOP_yield:
+    {
+        ret = do_yield();
+        break;
+    }
+
+    case SCHEDOP_exit:
+    {
+        kill_domain();
+        break;
+    }
+
+    default:
+        ret = -ENOSYS;
+    }
+
+    return ret;
+}
+
+/*
  * Control the scheduler
- ****************************************************************************/
+ */
 long sched_bvtctl(unsigned long c_allow)
 {
     ctx_allow = c_allow;
     return 0;
 }
 
-/****************************************************************************
+/*
  * Adjust scheduling parameter for a given domain
- ****************************************************************************/
+ */
 long sched_adjdom(int dom, unsigned long mcu_adv, unsigned long warp, 
                  unsigned long warpl, unsigned long warpu)
 {
@@ -239,14 +268,14 @@ long sched_adjdom(int dom, unsigned long mcu_adv, unsigned long warp,
     return 0;
 }
 
-/****************************************************************************
+/*
  * cause a run through the scheduler when appropriate
  * Appropriate is:
  * - current task is idle task
  * - the current task already ran for it's context switch allowance
  * Otherwise we do a run through the scheduler after the current tasks 
  * context switch allowance is over.
- ****************************************************************************/
+ */
 void reschedule(struct task_struct *p)
 {
     int cpu = p->processor;
@@ -286,13 +315,13 @@ void reschedule(struct task_struct *p)
 }
 
 
-/**************************************************************************** 
+/* 
  * The main function
  * - deschedule the current domain.
  * - pick a new domain.
  *   i.e., the domain with lowest EVT.
  *   The runqueue should be ordered by EVT so that is easy.
- ****************************************************************************/
+ */
 asmlinkage void __enter_scheduler(void)
 {
     struct task_struct *prev, *next, *next_prime, *p;
index 33115a7941b44c6010530c3fa1c8b73630670597..683efc007f0701cb2f62b9eca1a1cb320a4272b2 100644 (file)
 #define __HYPERVISOR_set_callbacks         5
 #define __HYPERVISOR_net_io_op             6
 #define __HYPERVISOR_fpu_taskswitch        7
-#define __HYPERVISOR_yield                 8
-#define __HYPERVISOR_exit                  9
-#define __HYPERVISOR_dom0_op              10
-#define __HYPERVISOR_network_op           11
-#define __HYPERVISOR_block_io_op          12
-#define __HYPERVISOR_set_debugreg         13
-#define __HYPERVISOR_get_debugreg         14
-#define __HYPERVISOR_update_descriptor    15
-#define __HYPERVISOR_set_fast_trap        16
-#define __HYPERVISOR_dom_mem_op           17
-#define __HYPERVISOR_multicall            18
-#define __HYPERVISOR_kbd_op               19
-#define __HYPERVISOR_update_va_mapping    20
+#define __HYPERVISOR_sched_op              8
+#define __HYPERVISOR_dom0_op               9
+#define __HYPERVISOR_network_op           10
+#define __HYPERVISOR_block_io_op          11
+#define __HYPERVISOR_set_debugreg         12
+#define __HYPERVISOR_get_debugreg         13
+#define __HYPERVISOR_update_descriptor    14
+#define __HYPERVISOR_set_fast_trap        15
+#define __HYPERVISOR_dom_mem_op           16
+#define __HYPERVISOR_multicall            17
+#define __HYPERVISOR_kbd_op               18
+#define __HYPERVISOR_update_va_mapping    19
 
 /* And the trap vector is... */
 #define TRAP_INSTR "int $0x82"
 #define EVENTS_MASTER_ENABLE_BIT  31
 
 
+/*
+ * SCHEDOP_* - Scheduler hypercall operations.
+ */
+#define SCHEDOP_yield           0
+#define SCHEDOP_exit            1
+
+
 #ifndef __ASSEMBLY__
 
 #include "network.h"
index 285319ab6ac9ff208f97ffcbe628dff10551f4c5..9450f76f3c0213538ab38e863ef8d7636866d3de 100644 (file)
@@ -245,7 +245,8 @@ static inline int HYPERVISOR_yield(void)
     int ret;
     __asm__ __volatile__ (
         TRAP_INSTR
-        : "=a" (ret) : "0" (__HYPERVISOR_yield) );
+        : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
+        "b" (SCHEDOP_yield) );
 
     return ret;
 }
@@ -255,7 +256,8 @@ static inline int HYPERVISOR_exit(void)
     int ret;
     __asm__ __volatile__ (
         TRAP_INSTR
-        : "=a" (ret) : "0" (__HYPERVISOR_exit) );
+        : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
+        "b" (SCHEDOP_exit) );
 
     return ret;
 }